/*
 * @Author: 肖思汗 
 * @Date: 2025-06-24 23:41:08 
 * @Last Modified by: 肖思汗
 * @Last Modified time: 2025-07-10 10:56:57
 */

import { autorun, makeAutoObservable } from "mobx";
import acceptInvitationApi from "./acceptInvitationApi";
import userStore from "src/pages/User/userStore";

class AcceptInvitationStore {
    constructor() {
        makeAutoObservable(this, {}, { deep: false });
        this.getDistributeConfig();
    }

    selfIncomeRate = 0.00  //推广用户自身下单收益比例
    firstHigherRate = 0.00  //用户下单第一上级收益比例
    secondHigherRate = 0.00  //用户下单第二上级收益比例
    eachDayIncomeMoney = 0.00  //每人每天提现金额上限
    promotionRole = ""  //推广规则
    sharePicture = ""  //分享弹窗图片
    popButtonText = ""  //弹窗按钮文案
    cashOutRole = "" //提现规则说明

    getDistributeConfig() {
        acceptInvitationApi.getDistributeConfig().then((res) => {
            if (res.code == 200) {
                this.selfIncomeRate = res.data.selfIncomeRate
                this.firstHigherRate = res.data.firstHigherRate
                this.secondHigherRate = res.data.secondHigherRate
                this.eachDayIncomeMoney = res.data.eachDayIncomeMoney
                this.promotionRole = res.data.promotionRole || "";
                this.sharePicture = res.data.sharePicture
                this.popButtonText = res.data.popButtonText
                this.cashOutRole = res.data.cashOutRole || "";;
            }
        })
    }

}

const acceptInvitationStore = new AcceptInvitationStore();

autorun(() => {
    if (userStore.isLogin) {
        acceptInvitationStore.getDistributeConfig();
    }
});

export default acceptInvitationStore;












